package com.myhome.controller;

import com.myhome.config.constant.R;
import com.myhome.model.LoginForm;
import com.myhome.model.LoginResult;
import com.myhome.service.MemberLoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.net.UnknownHostException;

/**
 * @Author QYiXin
 * @Date 2021 10 14 16 12
 **/
@RestController
@Api(tags = "会员登录控制器")
public class MemberLoginController {
    @Autowired
    MemberLoginService memberLoginService;
    @PostMapping("/login")
    @ApiOperation(value = "会员的登录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "loginForm",value = "登录的表单参数")
    })
    public R<LoginResult> memberLogin(@RequestBody LoginForm loginForm) throws UnknownHostException {
        LoginResult result = memberLoginService.login(loginForm);
        return R.ok(result);
    }
}
